<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var num = 1;
        num = num + 1;
        num = num + 1;
        console.log(num);
        //1.前置递增运算符 ++ 写在变量的前面
        var age = 10;
        ++age;//类似于age = age +1
        console.log(age);
        //2.先加1，后返回值
        var p = 10;
        console.log(++p + 10);//21
        //3.后置递增运算符 ++ 写在变量后面
        var a = 10;
        a++;//a = a + 1  和++a相同
        console.log(a);
        //3.1前置自增和后置自增如果单独使用，效果是一样的
        //3.2后置自增 口诀：先返回值，后自加1
        var b = 10;
        console.log(b++ + 10);//20
        console.log(age);//11
    </script>
</head>
<body>
    
</body>
</html>